<?php $this->load->view('teacher_home/_header') ?>
<?php $this->load->view('message') ?>

<link type="text/css" rel="stylesheet" href="<?php echo base_url()?>css/jquery.dataTables.min.css"/>
<script type="text/javascript" src="<?php echo base_url()?>js/jquery.dataTables.min.js"></script>

<script tyep="text/javascript">
  $().ready(function(){
    $("#module_li").addClass("active"); 
    $('#module_table').DataTable({
        paging: false,
        searching: false
        });  
    });

    function delete_item(id)
    {
        if(confirm("删除后自定义模块的考试内容将恢复为系统内容，确定吗？"))
            location.href="<?php echo site_url('teacher_module/delete').'/'?>"+id;
    }
</script>

<div class="container">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">当前的模块</h3>
        </div>
        <div class="panel-body">
            <div id="table">
                <table id="module_table" class="table table-striped table-hover ">
                    <thead>
                        <tr>
                            <th>序号</th>
                            <th>名称</th>
                            <th>所属类别</th>
                            <th>考试时间</th>
                            <th>类型</th>
                            <th>操作</th>
                            <th></th>
                            <th>
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $index=1; ?>
                        <?php foreach ($modules as $item ): ?>
                        <tr>
                            <td>
                                <?php echo $index++ ;?></td>
                            <td>
                                <?php echo $item['module_name']?></td>
                            <td>
                                <?php echo $item['big_lecture_name']?></td>
                            <td>
                                <?php echo $item['time_limit']?>分钟</td>
                            <td>
                                <?php if ($item['type']==1): ?>
                                    自定义
                                <?php elseif ($item['type']==0) :?>
                                    系统
                                <?php endif ?>
                            </td>
                            <td>
                                <a href="<?php echo site_url('teacher_module/check').'/'.$item['id']?>">查看</a>
                            </td>
                            <td>
                                <a href="<?php echo site_url('teacher_module/edit').'/'.$item['id']?>">编辑</a>
                            </td>
                            <td>
                                <?php if ($item['type']==1): ?>
                                    <a onclick="delete_item(<?=$item['id']?>)" href="#">删除</a>
                                <?php endif ?>
                            </td>
                        </tr>
                        <?php endforeach; ?></tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<?php $this->load->view('teacher_home/_footer')?>